package cn.gzsxt.music.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.gzsxt.music.mapper.RoleMapper;
import cn.gzsxt.music.query.RoleQueryObject;
import cn.gzsxt.music.service.RoleService;

@Service
public class RoleServiceImpl implements RoleService {
	@Autowired
	private RoleMapper roleMapper;
	
	@Override
	public Map<String, Object> selectRoleDataByCondition(RoleQueryObject qo) {
		
		Map<String, Object> dataGridMap = new HashMap<>();
		
		dataGridMap.put("total", roleMapper.selectRoleTotalByCondition(qo));
		dataGridMap.put("rows", roleMapper.selectRoleListByCondition(qo));
		
		return dataGridMap;
	}

	@Override
	public int saveRole(Map<String, Object> params) {
		return roleMapper.insert(params);
	}

	@Override
	public int deleteRoleById(Long role_id) {
		return roleMapper.deleteRoleById(role_id);
	}

	@Override
	public int updateRow(Map<String, Object> params) {
		// TODO Auto-generated method stub
		return roleMapper.update(params);
	}

	@Override
	public List<Map<String, Object>> getAllRoles() {
		return roleMapper.getAllRoles();
	}

	@Override
	public Map<String, Object> selectRoleByRoleId(Long roleId) {
		return roleMapper.selectRoleByRoleId(roleId);
	}

}
